<?php
include 'room_lib.php';

$a_css_files = array (
    array ( 'path' => 'plugins/bootstrap-modal/css/bootstrap-modal.css' ),
);

$a_js_files = array (
    array ( 'path' => 'plugins/jquery-file-upload/js/vendor/tmpl.min.js' ),
    array ( 'path' => 'plugins/bootstrap-modal/js/bootstrap-modal.js' ),
    array ( 'path' => 'plugins/bootstrap-modal/js/bootstrap-modalmanager.js' ),
    array ( 'path' => 'scripts/nh-room.js' ),
);

if (!$f_team) { raise_error('Vui lòng kiểm tra lại thông tin khởi tạo.'); }

$db_query = "
        select  roomid, team, level, crew, location, note
        from    room
        where   team = '$f_team' and level = '$f_level' and crew = '$f_crew'
        limit   0, 1";

$db_result = db_query($db_conn, $db_query);

if (db_num_rows($db_result)) { $d_room = db_fetch($db_result);  }

include 'lib_head.php';
?>
<form method="post" id="form1" action="room_execute.php" enctype="multipart/form-data">
    <table class="form">
        <tr>
            <td>
                <div class="field">
                    <label>Lớp</label>
                    <select name="team">
                    <?php foreach ($a_Nganh as $v_key => $v_value) { ?>
                        <option <?= $f_team == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                    <?php } ?>
                    </select>
                    <select name="level">
                        <option value=""></option>
                    <?php foreach ($a_Cap as $v_key => $v_value) { ?>
                        <option <?= $f_level == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                    <?php } ?>
                    </select>
                    <select name="crew">
                        <option value=""></option>
                    <?php foreach ($a_Doi as $v_key => $v_value) { ?>
                        <option <?= $f_crew == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                    <?php } ?>
                    </select>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="field">
                    <label>Vị Trí Học</label>
                    <input type="text" name="location" id="location" value="<?= check_plain($d_room->location) ?>"/>
                    <span class="redtext">(*)</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="field">
                    <label>Ghi Chú</label>
                    <textarea rows="5" cols="70" name="note"><?= $d_room->note ?></textarea>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="field">
                    <label>
                        <?= $s_InputString ?>
                        <input type="hidden" name="action" id="action" value="<?=$s_Action?>"/>
                        &ensp;
                    </label>
                    <input type="button" id="btnsubmit" class="button" value="Cập Nhật"/>
                    <input type="reset" class="button" value="Làm Lại"/>
                </div>
            </td>
        </tr>
    </table>
</form>
<?php include 'lib_tail.php'; ?>